Refresh DXL Attributes

I am looking to add a "Refresh DXL Attributes" button to a dialog box, does anyone know how to do it? Alternatively, does anyone know the name of the DXL file and function behind the "Refresh DXL Attributes" option on the standard "Tools" menu so I can call that?
SystemAdmin - Thu Apr 23 08:31:03 EDT 2009

Re: Refresh DXL Attributes
Rolan - Thu Apr 23 11:55:32 EDT 2009

Looks like the script at doorsHome\lib\dxl\utils\wipeattr.dxl is the one called by the Tools->Refresh DXL Attributes menu option.
I've been able to run it using the following code:
#include <utils\wipeattr.dxl>

Re: Refresh DXL Attributes
Tony_Goodman - Fri Apr 24 09:21:45 EDT 2009

Rolan - Thu Apr 23 11:55:32 EDT 2009
Looks like the script at doorsHome\lib\dxl\utils\wipeattr.dxl is the one called by the Tools->Refresh DXL Attributes menu option.
I've been able to run it using the following code:
#include <utils\wipeattr.dxl>

In your callback function add the following:

eval_("#include <utils\wipeattr.dxl>")
Alternatively, you can set the attribute value to null for all objects. This should force recalculation of the DXL attribute.

Re: Refresh DXL Attributes
SystemAdmin - Mon Apr 27 08:40:53 EDT 2009

Tony_Goodman - Fri Apr 24 09:21:45 EDT 2009
In your callback function add the following:

eval_("#include <utils\wipeattr.dxl>")
Alternatively, you can set the attribute value to null for all objects. This should force recalculation of the DXL attribute.

Thanks Folks, wipeattr.dxl does most of the job - setting to null on its own does not seem to work, although I agree that from all accounts it should! What it does not do is force a refresh for all objects, not just those that are currently in view. Any ideas?

Re: Refresh DXL Attributes
Rolan - Mon Apr 27 11:56:42 EDT 2009

SystemAdmin - Mon Apr 27 08:40:53 EDT 2009
Thanks Folks, wipeattr.dxl does most of the job - setting to null on its own does not seem to work, although I agree that from all accounts it should! What it does not do is force a refresh for all objects, not just those that are currently in view. Any ideas?

wipeattr.dxl calls refresh(Module m) after it sets the attributes to null.

Re: Refresh DXL Attributes
SystemAdmin - Mon Apr 27 12:26:06 EDT 2009

Rolan - Mon Apr 27 11:56:42 EDT 2009
wipeattr.dxl calls refresh(Module m) after it sets the attributes to null.

Yep, but that does not refresh DXL attributes for non-visible objects. It forces the attribute to refresh when it is next displayed, and as you scroll through the module the first time you will notice the drop-off in performance. Subsequent scrolling will be much faster, as values of the DXL attribute are fixed until wipeattr is re-run. The hypothesis I am working to is that most users will live with the one-off hit of waiting for the attributes to refresh when they ask them to - but they moan about slow scrolling!

Re: Refresh DXL Attributes
bungle_77 - Thu Jul 18 09:15:50 EDT 2013

SystemAdmin - Mon Apr 27 12:26:06 EDT 2009
Yep, but that does not refresh DXL attributes for non-visible objects. It forces the attribute to refresh when it is next displayed, and as you scroll through the module the first time you will notice the drop-off in performance. Subsequent scrolling will be much faster, as values of the DXL attribute are fixed until wipeattr is re-run. The hypothesis I am working to is that most users will live with the one-off hit of waiting for the attributes to refresh when they ask them to - but they moan about slow scrolling!

I solved this problem like this

 

                m=edit (fullName itm,true)
                        
                if (! null m) {
                    print "Updating module " name m "\n"
                    Skip skAttr=createString
                    for ad in m do {
                         if (ad.dxl) {
                             put (skAttr,ad.name,ad.name)
                         }
                    }
                    

                    for o in m do {

                                current = o
                                for s_DxlAttr in skAttr do {
                                    o.s_DxlAttr=(string null)    
                                    refresh m
                                }

                    }
                    delete skAttr
                    save m
                    close m
                }

Re: Refresh DXL Attributes
llandale - Thu Jul 18 16:42:12 EDT 2013

bungle_77 - Thu Jul 18 09:15:50 EDT 2013

I solved this problem like this

 

                m=edit (fullName itm,true)
                        
                if (! null m) {
                    print "Updating module " name m "\n"
                    Skip skAttr=createString
                    for ad in m do {
                         if (ad.dxl) {
                             put (skAttr,ad.name,ad.name)
                         }
                    }
                    

                    for o in m do {

                                current = o
                                for s_DxlAttr in skAttr do {
                                    o.s_DxlAttr=(string null)    
                                    refresh m
                                }

                    }
                    delete skAttr
                    save m
                    close m
                }

DXL attr values are NOT stored in the database and are not "saved".  Therefore:

  • You don't need to "edit" a module to "refresh" dxl attributes.  "read" will do
  • DXL attr values are null when you open a module and are therefore "refreshed".  opening-calculating-saving-closing doesn't do anything.

Other notes:

  • You only need to "refresh" your have displayed or retrieved the value and they you believe something else changed that would change the value.  So if the attr-DXL displayes link info and you added a link you would want to refresh
  • You only want Attr-DXL that applies to objects.  Change to this:
    >>>  if (ad.dxl and ad.object) {
  • You want to refresh ALL values, not just those currently displayed:
    >>> for o in entire m do{' if (isDeleted)o)) continue
  • You should "refresh m" at the bottom, not in the center of the 2nd indented loop.
  • You have no commands that presume the "current" object so this command is not needed.  In fact, changing the "current" object can often be bad.  Remove this:
    >>> current = o

And a rather obscure nit-pick.  It is possible to command to open "edit" a module but it comes back read-only.  This happens when someone else has it open and you are prompted.  You therefore need one of the following:

  • m=edit (fullName itm,true, true)       // open "silent", do not prompt if someone else has it open
  • if (!null m or !isEdit(m))

-Louie

I routinely do this, open invisible, silent, and load the standard view rather than the default view

m=edit (fullName itm,false, true, true) 

Re: Refresh DXL Attributes
bungle_77 - Fri Jul 19 03:43:39 EDT 2013

llandale - Thu Jul 18 16:42:12 EDT 2013

DXL attr values are NOT stored in the database and are not "saved".  Therefore:

  • You don't need to "edit" a module to "refresh" dxl attributes.  "read" will do
  • DXL attr values are null when you open a module and are therefore "refreshed".  opening-calculating-saving-closing doesn't do anything.

Other notes:

  • You only need to "refresh" your have displayed or retrieved the value and they you believe something else changed that would change the value.  So if the attr-DXL displayes link info and you added a link you would want to refresh
  • You only want Attr-DXL that applies to objects.  Change to this:
    >>>  if (ad.dxl and ad.object) {
  • You want to refresh ALL values, not just those currently displayed:
    >>> for o in entire m do{' if (isDeleted)o)) continue
  • You should "refresh m" at the bottom, not in the center of the 2nd indented loop.
  • You have no commands that presume the "current" object so this command is not needed.  In fact, changing the "current" object can often be bad.  Remove this:
    >>> current = o

And a rather obscure nit-pick.  It is possible to command to open "edit" a module but it comes back read-only.  This happens when someone else has it open and you are prompted.  You therefore need one of the following:

  • m=edit (fullName itm,true, true)       // open "silent", do not prompt if someone else has it open
  • if (!null m or !isEdit(m))

-Louie

I routinely do this, open invisible, silent, and load the standard view rather than the default view

m=edit (fullName itm,false, true, true) 

hi Louie

if i don't move the current object it doesn't work., becouse it will be updated only the visible objects.

I need to open in edit mode and save because my dxl attribute compute also other attributes.

 

Re: Refresh DXL Attributes
llandale - Fri Jul 19 11:05:21 EDT 2013

bungle_77 - Fri Jul 19 03:43:39 EDT 2013

hi Louie

if i don't move the current object it doesn't work., becouse it will be updated only the visible objects.

I need to open in edit mode and save because my dxl attribute compute also other attributes.

 

I think you are saying

[1] Your particular Attr-DXL changes something in the module other than the obj.attrDXLName value.  Perhaps it does something like this:

  • Results = whatever
  • obj.attrDXLName = results
  • obj."SomeOtherAttr" = results

[2] Your "whatever" has weird code that requires the "current" object. 

If so...

[1] Your code doesn't refresh DXL attrs, it refreshes this other attr.

[2] My guess is that you have some "poor" strategy and should re-think it.  Relying on the "current object", IMO, is a likely mistake.

-Louie

Re: Refresh DXL Attributes
bungle_77 - Fri Jul 19 11:27:28 EDT 2013

llandale - Fri Jul 19 11:05:21 EDT 2013

I think you are saying

[1] Your particular Attr-DXL changes something in the module other than the obj.attrDXLName value.  Perhaps it does something like this:

  • Results = whatever
  • obj.attrDXLName = results
  • obj."SomeOtherAttr" = results

[2] Your "whatever" has weird code that requires the "current" object. 

If so...

[1] Your code doesn't refresh DXL attrs, it refreshes this other attr.

[2] My guess is that you have some "poor" strategy and should re-think it.  Relying on the "current object", IMO, is a likely mistake.

-Louie

you understood well. I tried many strategies, but they didn't work, if you have something to suggest, it will be welcome.

Re: Refresh DXL Attributes
bungle_77 - Tue May 17 05:14:28 EDT 2016

Hi,

i still didn't solve my problem.

In my module i have three attributes A, B , C

A is a DXL attribute

in the code of A i set also the value for B & C

I load a view that doesn't show A

If i use eval_("#include <utils\wipeattr.dxl>") or i launch "Tools->Refresh DXL Attributes"  B & C are not updated.

 

How can i solve this problem with DXL code?

Re: Refresh DXL Attributes
DOORSHAM - Tue May 17 06:50:30 EDT 2016

bungle_77 - Tue May 17 05:14:28 EDT 2016

Hi,

i still didn't solve my problem.

In my module i have three attributes A, B , C

A is a DXL attribute

in the code of A i set also the value for B & C

I load a view that doesn't show A

If i use eval_("#include <utils\wipeattr.dxl>") or i launch "Tools->Refresh DXL Attributes"  B & C are not updated.

 

How can i solve this problem with DXL code?

Try something like following pseudocode

 

obj.AttribueName = null

Re: Refresh DXL Attributes
bungle_77 - Tue May 17 12:04:48 EDT 2016

DOORSHAM - Tue May 17 06:50:30 EDT 2016

Try something like following pseudocode

 

obj.AttribueName = null

it doesn't work

Re: Refresh DXL Attributes
DOORSHAM - Tue May 17 12:32:49 EDT 2016

bungle_77 - Tue May 17 12:04:48 EDT 2016

it doesn't work

You could of told us what you tried so we could see where you failed to implement correctly.

 

Help file says:

// resetting to (string null)
// in a DXL program
// will force re-calculation
 

Re: Refresh DXL Attributes
DoorsXLAustralia - Tue May 17 22:27:09 EDT 2016

My understanding is that the DXL attribute updates when it is 'accessed'.

This access does not need to involve displaying the attribute value; it can simply be querying the attribute value.

If you want to force an update of all your DXL attribute values which are not displayed then try a simple object loop DXL such as

Object o
Module m = current
for o in m do
{
  string s  = o."My DXL Hidden Attribute" ""
}
refresh m


N.B. this is not an attribute DXL; this is a standalone DXL script which you would run from a menu in a module containing an undisplayed DXL attribute called "My DXL Hidden Attribute"

 

bungle_77 :- In my module i have three attributes A, B , C

A is a DXL attribute

in the code of A i set also the value for B & C

 

This forced update of the DXL attribute (A) would then force an update of the dependent non-dxl attributes (B and C) which are currently displayed.
 

Sean

Re: Refresh DXL Attributes
Costas..Aravidis - Thu May 19 02:38:22 EDT 2016

When the module has a lot of objects then the view will not update all the objects. I found that by doing an export and the dxl layout was not displaying correctly. Usually the dxl attribute works fine and it will update when you open the module or you change state, or when you refresh the module.

Have you check if you can write in attributes B and C?

But in general the dxl attribute will only be calculated the first time that will be accessed. That means the first time that you open the module, or when you change from read to edit. Also it will be calculated on events. You need to be displaying the dxl attribute when you are using refresh. You need an event to update the dxl attribute. Thus as above if you set the dxl attribute to null in a view it should be updated. But not every object in a view is updated at one time.